home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / t_gen / t_gen.lha / misc-changes.r4.1.st < prev    next >
Text File  |  1993-07-19  |  7KB  |  232 lines

  1.  
  2. !Object methodsFor: 'copyrights'!
  3.  
  4. tgenCopyright
  5.     "Bring up a read-only text window with the T-gen copyright notice."
  6.     "Object tgenCopyright"
  7.  
  8.     | copyright aComposedTextView topView |
  9.     copyright := 'The authors make NO WARRANTY or representation, either express or implied, with respect to this software, its quality, accuracy, merchantability, or fitness for a particular purpose.  This software is provided "AS IS", and you, its user, assume the entire risk as to its quality and accuracy.
  10.  
  11. This software is copyright (c) 1992 by Justin O. Graver.
  12. All rights reserved, except as specified below.
  13.  
  14. Permission is hereby granted to use, copy, modify, and distribute this software (or portions thereof) for any purpose, without fee, subject to these conditions:
  15. (1) If any part of the source code for this software is distributed, then this notice must be included, unaltered; and any additions, deletions, or changes to the original files must be clearly indicated in accompanying documentation.
  16. (2) Permission for use of this software is granted only if the user accepts full responsibility for any undesirable consequences; the authors accept NO LIABILITY for damages of any kind.
  17.  
  18. Permission is NOT granted for the use of any author''s name in advertising or publicity relating to this software or products derived from it.
  19.  
  20. We specifically permit and encourage the use of this software as the basis of commercial products, provided that all warranty or liability claims are assumed by the product vendor.
  21.  
  22. Developed under the direction of Justin Graver.
  23. Authors include: Justin Graver, Virat Hanvivatpong, and David Wilson.
  24.  
  25. Send any comments, suggestions, or defects to: graver@comm.mot.com.'.
  26.  
  27.     aComposedTextView := ComposedTextView model: (ValueHolder with: copyright).
  28.     topView := ScheduledWindow new.
  29.     topView controller model: aComposedTextView model.
  30.     topView component: (LookPreferences edgeDecorator on: aComposedTextView).
  31.     topView label: TranslatorGenerator versionName , ' Copyright Notice'.
  32.     topView minimumSize: 470 @ 550.
  33.     aComposedTextView controller: NoController new.
  34.     topView open! !
  35.  
  36. !TranslatorGenerator methodsFor: 'status text'!
  37.  
  38. statusTextBufferMenu
  39.     "TranslatorGenerator flushMenus"
  40.  
  41.     ^StatusTextBufferMenu isNil
  42.         ifTrue: [StatusTextBufferMenu := PopUpMenu
  43.                         labelList: #(('again' 'undo') ('copy' 'cut' 'paste') ('accept' 'cancel') ('result' 'builder' 'grammar' 'parser' 'scanner') ('install') ('save specs' 'load specs'))
  44.                         values: #(#again #undo #copySelection #cut #paste #accept #cancel #inspectResult #defineTreeBuilderClass #inspectGrammar #inspectParser #defineScannerClass #installScannerAndParserClasses #saveSpecs #loadSpecs)]
  45.         ifFalse: [StatusTextBufferMenu]! !
  46.  
  47.  
  48. !TranslatorGenerator methodsFor: 'grammar text'!
  49.  
  50. textMenu
  51.     "Answer an pop-up menu of operations on the source code that is to be 
  52.     displayed when the operate menu button is pressed."
  53.     "TranslatorGenerator flushMenus"
  54.  
  55.     ^TextMenu isNil
  56.         ifTrue: [TextMenu := PopUpMenu
  57.                         labelList: #(('again' 'undo') ('copy' 'cut' 'paste') ('accept' 'cancel'))
  58.                         values: #(#again #undo #copySelection #cut #paste #alwaysAccept #cancel )]
  59.         ifFalse: [TextMenu]! !
  60.  
  61.  
  62. !TranslatorGeneratorView methodsFor: 'private-subview creation'!
  63.  
  64. addGrammarModeView: area on: aModel 
  65.  
  66.     | buttonViews |
  67.     buttonViews := OrderedCollection new.
  68.     buttonViews
  69.          add: (self
  70.                     label: 'LL(1)'
  71.                     model: aModel
  72.                     getSelector: #grammarMode
  73.                     putSelector: #setGrammarMode:
  74.                     selectorValue: aModel llModeMarker);
  75.          add: (self
  76.                     label: 'SLR(1), LALR(1), LR(1)'
  77.                     model: aModel
  78.                     getSelector: #grammarMode
  79.                     putSelector: #setGrammarMode:
  80.                     selectorValue: aModel lrModeMarker);
  81.          add: (self
  82.                     label: 'don''t care'
  83.                     model: aModel
  84.                     getSelector: #grammarMode
  85.                     putSelector: #setGrammarMode:
  86.                     selectorValue: aModel defaultModeMarker).
  87.     self
  88.         add: (DialogView new
  89.                 addRow: buttonViews
  90.                 fromX: 0
  91.                 toX: 1
  92.                 collect: [:each | BorderedWrapper on: each])
  93.         in: area!
  94.  
  95. addParserModeView: area on: aModel 
  96.  
  97.     | buttonViews |
  98.     buttonViews := OrderedCollection new.
  99.     buttonViews
  100.          add: (self
  101.                     label: 'Derivation'
  102.                     model: aModel
  103.                     getSelector: #parserMode
  104.                     putSelector: #setParserMode:
  105.                     selectorValue: aModel defaultModeMarker);
  106.          add: (self
  107.                     label: 'Trace'
  108.                     model: aModel
  109.                     getSelector: #parserMode
  110.                     putSelector: #setParserMode:
  111.                     selectorValue: aModel traceModeMarker);
  112.          add: (self
  113.                     label: 'sham AST'
  114.                     model: aModel
  115.                     getSelector: #parserMode
  116.                     putSelector: #setParserMode:
  117.                     selectorValue: aModel shamAstModeMarker);
  118.          add: (self
  119.                     label: 'AST'
  120.                     model: aModel
  121.                     getSelector: #parserMode
  122.                     putSelector: #setParserMode:
  123.                     selectorValue: aModel astModeMarker).
  124.     self
  125.         add: (DialogView new
  126.                 addRow: buttonViews
  127.                 fromX: 0
  128.                 toX: 1
  129.                 collect: [:each | BorderedWrapper on: each])
  130.         in: area! !
  131.  
  132.  
  133. TextView subclass: #UpdateRequestTextView
  134.     instanceVariableNames: 'updatePrompt '
  135.     classVariableNames: ''
  136.     poolDictionaries: ''
  137.     category: 'Interface-Text'!
  138. UpdateRequestTextView comment:
  139. '=================================================
  140.     Copyright (c) 1992 by Justin O. Graver.
  141.     All rights reserved (with exceptions).
  142.     For complete information evaluate "Object tgenCopyright."
  143. =================================================
  144.  
  145. This class allows users to specify the confirmation message used when a "May one of your dependents change?" update request is received.
  146.  
  147. Instance Variables
  148.  
  149.     updatePrompt    <String> - prompt text used when update request is received.'!
  150.  
  151.  
  152. !UpdateRequestTextView methodsFor: 'updating'!
  153.  
  154. updateRequest
  155.     "Answer regarding whether the receiver may change."
  156.  
  157.     ^self controller updateRequest
  158.         ifTrue: [true]
  159.         ifFalse: [DialogView confirm: self updatePrompt]! !
  160.  
  161. !UpdateRequestTextView methodsFor: 'state accessing'!
  162.  
  163. updatePrompt
  164.  
  165.     ^updatePrompt!
  166.  
  167. updatePrompt: argument 
  168.  
  169.     updatePrompt := argument! !
  170. "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
  171.  
  172. UpdateRequestTextView class
  173.     instanceVariableNames: ''!
  174.  
  175.  
  176. !UpdateRequestTextView class methodsFor: 'instance creation'!
  177.  
  178. on: anObject aspect: aspectMsg change: changeMsg menu: menuMsg updatePrompt: aString 
  179.  
  180.     | aView |
  181.     aView := self new.
  182.     aView
  183.         on: anObject
  184.         aspect: aspectMsg
  185.         change: changeMsg
  186.         menu: menuMsg.
  187.     aView updatePrompt: aString.
  188.     ^aView! !
  189.  
  190.  
  191. NonrelianceTextView subclass: #TranscriptView
  192.     instanceVariableNames: ''
  193.     classVariableNames: ''
  194.     poolDictionaries: ''
  195.     category: 'Tools-Transcript'!
  196. TranscriptView comment:
  197. '=================================================
  198.     Copyright (c) 1992 by Justin O. Graver.
  199.     All rights reserved (with exceptions).
  200.     For complete information evaluate "Object tgenCopyright."
  201. =================================================
  202.  
  203. This class implements a pluggable version of TextView.  It can be used like a Transcript (i.e. a TextCollector).'!
  204.  
  205. !TranscriptView methodsFor: 'updating'!
  206.  
  207. appendEntry: aString 
  208.  
  209.     | text |
  210.     self deselect.
  211.     text := self displayContents text.
  212.     text size > 2000 ifTrue: [self controller removeFirstChars: text size - 1000].
  213.     self selectAt: text size + 1.
  214.     self controller replaceSelectionWith: aString asText.
  215.     self selectAt: text size + 1.
  216.     self selectAndScroll.
  217.     self deselect!
  218.  
  219. clear
  220.  
  221.     self newText: ComposedText new!
  222.  
  223. update: aSymbol 
  224.  
  225.     | text |
  226.     aSymbol == partMsg
  227.         ifTrue: 
  228.             [text := self getContents.
  229.             ^self appendEntry: text].
  230.     aSymbol == #clear ifTrue: [^self clear]! !
  231.  
  232.